<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 数组方法 </title>
</head>
<body>
<h2>自动 toString()</h2>
<p>toString() 方法以逗号分隔的字符串返回数组：</p>


<p id="demo"></p>

<script>
  var fruits = ["Banana", "Orange", "Apple", "Mango"];
  document.getElementById("demo").innerHTML = fruits.toString();
</script>

</body>
</html>

<!--Banana,Orange,Apple,Mango-->
<!--
当需要一个简单的值时，JavaScript 会自动将数组转换为逗号分隔的字符串：
docu...=fruits;     Banana,Orange,Apple,Mango
-->